ifeq ($(DESTDIR),)
	DESTDIR := /
endif

ifeq ($(PREFIX),)
	PREFIX := usr/
endif


.PHONY : bundle
bundle:
	# Clone pywwt as needed
	if [ ! -d "./pywwt" ]; then \
		git clone --recurse-submodules "https://notabug.org/CYBERDEViL/pywwt"; \
	fi
	# Build pywwt
	@cd pywwt && $(MAKE) bundle
	# Build Wiizard
	@python3 setup.py build


.PHONY : install
install:
	# Install pywwt
	@PREFIX="$(PREFIX)" DESTDIR="${DESTDIR}" $(MAKE) -C ./pywwt/ install
	# Install Wiizard
	@python3 setup.py install --root="$(DESTDIR)" --optimize=1 --skip-build
